home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / comms / other / ftransapiv1.3 / arexx / ftransamirc.amirx next >
Text File  |  1999-11-30  |  3KB  |  122 lines

  1. /* 
  2.  
  3.  -----------------------------------------------
  4.  Amirc Translator By FTranslator Client 
  5.  
  6.  Script by Cristian Robert Gallas
  7.  
  8.  Tested with Amirc 2.2
  9.  Usage:                                
  10.  Use in ARexx interface of Amirc      
  11.  $VER: FTransAMIRC.amirx v1.1 (25.09.99)
  12.  -----------------------------------------------
  13.  
  14.  HISTORY
  15.  -----------------------------------------------
  16.  v0.01b [11.08.98] - First public beta version;
  17.  v1.0   [01.05.99] - Added new options;
  18.  v1.1   [25.09.99] - Modified to FTrans 1.2 API;
  19.  -----------------------------------------------
  20.  
  21.  [Steps installation]
  22.  
  23.  > Go to Amirc Configuration
  24.  > Create a new button
  25.  > Name of button [Port->Eng] (example: Portugues to English)
  26.  > /rx FTransAmirc.amirx 3 (3 is a translation direction)
  27.  > Select text click [Port->Eng] and see! :)
  28.  
  29.  0 - English   to Francais
  30.  1 - English   to Deutsch
  31.  2 - English   to Italiano
  32.  3 - English   to Portugues
  33.  4 - English   to Espanol
  34.  5 - Francais  to English
  35.  6 - Deutsch   to English
  36.  7 - Italiano  to English
  37.  8 - Espanol   to English
  38.  9 - Portugues to English
  39.  
  40. */
  41.  
  42. Options Results
  43.  
  44. tmpfile = 'Ram:FTransTmp.AMIRC'
  45. tmpclip = 'Ram:FTransAmirc.Clip'
  46.  
  47. ARG traduz
  48.  
  49. /* TESTA SE PODE SER USADAS AS LIBS DO AREXX */
  50. if ~show(l, "rexxsupport.library") then
  51.   if ~addlib("rexxsupport.library", 0, -30) then
  52.     exit
  53. if ~show(l, "rexxtricks.library") then
  54.   if ~addlib("rexxtricks.library", 0, -30) then
  55.     exit
  56.  
  57. /* TESTA SE O PROGRAMA JA NAO ESTA COM A PORTA DE TRADUCAO ABERTA */
  58. if exists(tmpfile) then do
  59.   cecho('FTranslation port is open! Translation in progress, wait...')
  60.   exit
  61. end
  62.  
  63. /* COLOCA COMO DEFAULT PORTUGUES TO ENGLISH */
  64. if traduz = "" then do
  65.   /* LE INFORMACOES SOBRE A TELA CORRENTE */
  66. "INFO screen"
  67.   pubs='"'||result||'"'
  68.   if pubs= '""' then pubs='"Workbench"'
  69.  
  70.   cecho('DIRECTIONS:')
  71.   cecho('')
  72.   cecho(' 1  - English   to Francais')
  73.   cecho(' 2  - English   to Deutsch')
  74.   cecho(' 3  - English   to Italiano')
  75.   cecho(' 4  - English   to Portugues')
  76.   cecho(' 5  - English   to Espanol')
  77.   cecho(' 6  - Francais  to English')
  78.   cecho(' 7  - Deutsch   to English')
  79.   cecho(' 8  - Italiano  to English')
  80.   cecho(' 9  - Espanol   to English')
  81.   cecho(' 10 - Portugues to English')
  82.   traduz = rtezrequest("Select the direction to translate", "1|2|3|4|5|6|7|8|9|10|Cancel",,'RT_PUBSCRNAME='pubs)
  83.   if(traduz = 0) then do
  84.     cecho('FTrans canceled...')
  85.     exit
  86.   end
  87.   traduz = traduz - 1
  88. end
  89.  
  90. /* LE O CLIPBOARD COM UMA FUNCAO DO AREXXTRICKS */
  91. sel = ReadClipboard(0)
  92.  
  93. call open(1, tmpclip, 'W')
  94. call writeln(1, sel)
  95. call close(1)
  96.  
  97. /* EXECUTA O FTRANSLATOR COM OS ARGUMENTOS DA TRADUCAO */
  98.  
  99. cecho('FTranslator^Amirc plugin v0.01')
  100. cecho('Waiting, initiating Freedom translation...')
  101. comando = 'C:FTranslator -f "'tmpclip'" -d 'traduz' SILENCE > 'tmpfile
  102. Address Command comando
  103. delete(tmpclip)
  104.  
  105. goodopen=open(1, tmpfile, 'R')
  106. linein = ''
  107. if goodopen then do
  108.   do until eof(1)
  109.     linein = readln(1)
  110.     cecho(linein)
  111.   end
  112. end
  113. close(1)
  114. delete(tmpfile)
  115.  
  116. exit
  117.  
  118. /* FUNCAO DE DISPLAY */
  119. cecho:
  120. "ECHO P="d2c(27)"b«"FTrans"» C=6" arg(1)
  121. return 0
  122.